xen.git
18 years agominios: drop unused xenblk_rxidx function
Keir Fraser [Thu, 14 Feb 2008 09:24:35 +0000 (09:24 +0000)]
minios: drop unused xenblk_rxidx function
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
18 years agostubdom: optimize block io completion polling by not polling all the
Keir Fraser [Thu, 14 Feb 2008 09:23:14 +0000 (09:23 +0000)]
stubdom: optimize block io completion polling by not polling all the
time; only when some requests have completed.

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
18 years agoMini-OS: Fix alignment in maybe_split()
Keir Fraser [Thu, 14 Feb 2008 09:22:33 +0000 (09:22 +0000)]
Mini-OS: Fix alignment in maybe_split()
Needed on ia64, speeds up on x86.
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
18 years agoxen: Clean up SMP/hotplug headers and implementation a bit.
Keir Fraser [Wed, 13 Feb 2008 18:30:12 +0000 (18:30 +0000)]
xen: Clean up SMP/hotplug headers and implementation a bit.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
18 years agovmx realmode: Only check for pending interrupts every 16th
Keir Fraser [Wed, 13 Feb 2008 18:09:27 +0000 (18:09 +0000)]
vmx realmode: Only check for pending interrupts every 16th
instruction, since it is a moderately expensive operation.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
18 years agovmx realmode: __hvm_copy() should not hvm_get_segment_register() when
Keir Fraser [Wed, 13 Feb 2008 16:35:51 +0000 (16:35 +0000)]
vmx realmode: __hvm_copy() should not hvm_get_segment_register() when
we are emulating. Firstly it is bogus, since VMCS segment state is
stale in this context. Secondly, real mode and real->protected
contexts are rather unlikely tohappen with SS.DPL == 3.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
18 years agox86 vmx: Streamline vmx_interrupt_blocked() to avoid a VMREAD if
Keir Fraser [Wed, 13 Feb 2008 16:28:38 +0000 (16:28 +0000)]
x86 vmx: Streamline vmx_interrupt_blocked() to avoid a VMREAD if
interrupt delivery is blocked by EFLAGS.IF. This speeds up real-mode
emulation in some cases (where we are currently executing
hvm_local_events_need_delivery() after every instruction).
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
18 years agox86 vmx: Remove bogus BUG_ON() introduced in previous changeset.
Keir Fraser [Wed, 13 Feb 2008 16:25:32 +0000 (16:25 +0000)]
x86 vmx: Remove bogus BUG_ON() introduced in previous changeset.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
18 years agox86 hvm: Factor out save/restore of segment registers from VMX/SVM
Keir Fraser [Wed, 13 Feb 2008 14:03:58 +0000 (14:03 +0000)]
x86 hvm: Factor out save/restore of segment registers from VMX/SVM
files into common HVM code.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
18 years agoTools: fix save/restore of 32-bit PV guests with 64-bit tools
Keir Fraser [Wed, 13 Feb 2008 10:43:13 +0000 (10:43 +0000)]
Tools: fix save/restore of 32-bit PV guests with 64-bit tools
by removing some obvious typos, handling CR3 folding and hvirt_start
based on guest word-size, and understanding 32-bit INVALID_MFN.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
18 years agopv-on-hvm: Signal crash to Xen tools when HVM guest panics.
Keir Fraser [Wed, 13 Feb 2008 10:42:09 +0000 (10:42 +0000)]
pv-on-hvm: Signal crash to Xen tools when HVM guest panics.

Attached patch adds a function to automatically dump core file when
guest linux on HVM domain panics, in the same way as PV domain.

I tested this patch with kernel 2.6.9 and 2.6.18 on both of x86 and
ia64 (to buid for ia64, some patches in the ia64 tree are needed) by
the following steps, and confirmed it works well:

1. Build xen-platform-pci.ko.
2. In /etc/xen/xend-config.sxp, set (enable-dump yes).
3. On guest linux, execute insmod:
   # insmod xen-platform-pci.ko
4. When guest linux panics, a core file is dumped.

Signed-off-by: Tetsu Yamamoto <yamamoto.tetsu@jp.fujitsu.com>
18 years agostubdom: missing two renames (avoids always re-compiling newlib)
Keir Fraser [Tue, 12 Feb 2008 16:59:08 +0000 (16:59 +0000)]
stubdom: missing two renames (avoids always re-compiling newlib)
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
18 years agostubdom: Rename stubdom/*.build into stubdom/*-build, newlib into
Keir Fraser [Tue, 12 Feb 2008 16:46:23 +0000 (16:46 +0000)]
stubdom: Rename stubdom/*.build into stubdom/*-build, newlib into
newlib-cvs, lwip into lwip-cvs.  Fix .hgignore to ignore only them and
not the patches.

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
18 years agoMake stubdom/Makefile override XEN_OS to MiniOS, and add
Keir Fraser [Tue, 12 Feb 2008 15:03:07 +0000 (15:03 +0000)]
Make stubdom/Makefile override XEN_OS to MiniOS, and add
config/MiniOS.mk. Add PTHREAD_LIBS to configs (usually holding
-lpthread).

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
18 years ago[BUILD] Disable LOCALVERSION_AUTO in upstream Linux builds.
Keir Fraser [Tue, 12 Feb 2008 14:59:22 +0000 (14:59 +0000)]
[BUILD] Disable LOCALVERSION_AUTO in upstream Linux builds.

If this option is enabled then the Xen mercurial version ID gets
tacked onto the kernel version (e.g. 2.6.24-git22-hg2593b69b183b)
which is unlikely to be useful or desirable. All the trees which we
build using this method already have uniquely identifying versions
(e.g. 2.6.24-git22 or 2.6.24-mm1).

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
18 years ago[BUILD] Fixup support for building upstream kernels.
Keir Fraser [Tue, 12 Feb 2008 14:59:01 +0000 (14:59 +0000)]
[BUILD] Fixup support for building upstream kernels.

In particular:
 - support merged x86 architecture. To facilitate this it made sense
   to encode some existing logic in shell scripts rather than
   increasing complicated make conditionals.
 - set CONFIG_PARAVIRT_GUEST=y which is required for newer kernels.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
18 years ago[BUILD] Add option to ensure kernel build is non-interactive.
Keir Fraser [Tue, 12 Feb 2008 14:57:36 +0000 (14:57 +0000)]
[BUILD] Add option to ensure kernel build is non-interactive.

This is useful for the non 2.6.18-xen builds where the defconfig at
any particular momement may require additional questions to be
answered.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
18 years agoAdd stubdomain support. See stubdom/README for usage details.
Keir Fraser [Tue, 12 Feb 2008 14:35:39 +0000 (14:35 +0000)]
Add stubdomain support. See stubdom/README for usage details.

- Move PAGE_SIZE and STACK_SIZE into __PAGE_SIZE and __STACK_SIZE in
  arch_limits.h so as to permit getting them from there without
  pulling all the internal Mini-OS defines.
- Setup a xen-elf cross-compilation environment in stubdom/cross-root
- Add a POSIX layer on top of Mini-OS by linking against the newlib C
  library and lwIP, and implementing the Unixish part in mini-os/lib/sys.c
- Cross-compile zlib and libpci too.
- Add an xs.h-compatible layer on top of Mini-OS' xenbus.
- Cross-compile libxc with an additional xc_minios.c and a few things
  disabled.
- Cross-compile ioemu with an additional block-vbd, but without sound,
  tpm and other details.  A few hacks are needed:
  - Align ide and scsi buffers at least on sector size to permit
  direct transmission to the block backend. While we are at it, just
  page-align it to possibly save a segment. Also, limit the scsi
  buffer size because of limitations of the block paravirtualization
  protocol.
  - Allocate big tables dynamically rather that letting them go to
  bss: when Mini-OS gets installed in memory, bss is not lazily
  allocated, and doing so during Mini-OS is unnecessarily trick while
  we can simply use malloc.
- Had to change the Mini-OS compilation somehow, so as to export
  Mini-OS compilation flags to the Makefiles of libxc and ioemu.

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
18 years agolibxenctrl headers should not pollute macro namespace with
Keir Fraser [Tue, 12 Feb 2008 11:37:45 +0000 (11:37 +0000)]
libxenctrl headers should not pollute macro namespace with
mb/rmb/wmb. Instead add a xen_ prefix. Modify Xen's public headers to
expect the prefixed names instead of bare mb/rmb/wmb, but gate this
expectation on a bump of __XEN_INTERFACE_VERSION__.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
18 years agodevice-dm: Use SIGHUP before SIGKILL
Keir Fraser [Tue, 12 Feb 2008 10:57:49 +0000 (10:57 +0000)]
device-dm: Use SIGHUP before SIGKILL

Make qemu unblock SIGHUP and make sure the default handler is in
place. Have the domain killer send SIGHUP to the device-model script,
allow the script 10s to clean up, and if still not dead, send
SIGKILL.

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
18 years agoxend: Remove redundant check of maximum memory size.
Keir Fraser [Tue, 12 Feb 2008 10:19:12 +0000 (10:19 +0000)]
xend: Remove redundant check of maximum memory size.

Currently, a wrong value of maximum memory size is checked by
_safe_set_memory() and _memory_sanity_check().

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
18 years agoAdd timestamp option to xenconsoled
Keir Fraser [Tue, 12 Feb 2008 10:16:20 +0000 (10:16 +0000)]
Add timestamp option to xenconsoled

Similar to the --log option, --timestamp or -t takes:
- none : No timestamping
- hv   : Timestamp hypervisor logs
- guest: Timestamp guest logs
- all  : Timestamp guest and hypervisor logs

From: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
18 years agoRendezvous selected cpus in softirq (stop_machine).
Keir Fraser [Mon, 11 Feb 2008 15:59:49 +0000 (15:59 +0000)]
Rendezvous selected cpus in softirq (stop_machine).

This is similar to stop_machine_run stub from Linux, to pull
selected cpus in rendezvous point and the do some batch work
under a safe environment. Current one usage is from S3 path,
where individual cpu is pulled down with related online
footprints being cleared. It's dangerous to have other cpus
checking clobbered data structure in the middle, such as
cpu_online_map, cpu_sibling_map, etc.

Signed-off-by: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
18 years agoioemu: Dynamic VNC colour depth.
Keir Fraser [Mon, 11 Feb 2008 14:55:33 +0000 (14:55 +0000)]
ioemu: Dynamic VNC colour depth.

The qemu vnc server changes its internal colour depth based on the
client request. This way just one colour conversion is done: the one
in  vga_template.h, from the guest colour depth and the vnc server
internal colour depth.

This patch is meant to remove this colour conversion to improve
performances. It accomplishes the goal making the qemu internal colour
depth always the same as the guest colour depth.
The basic idea is that the vnc client is the one that should do the
colour conversion, if necessary. In general it should accept the pixel
format suggested by the server during the initial negotiation. This
behaviour can be set in most vnc clients (vncviewer included).

If the guest changes colour depth, the qemu vnc server changes colour
depth too and notifies the client. The problem is that the vnc
protocol doesn't provide a message from the server to the client to
ask for a colour depth change. So what I am doing is either:

1) quietly starting to do the conversion on vnc server (not gaining
   any performance here);

2) closing the vnc connection with the client, so the client can
   reconnect and choose the new pixel format.

By default I am doing 1), however the second choice can be enabled
passing the -vnc-switch-bpp command line option.
In order to do the colour conversion on the vnc server I had to
improve the colour conversion code already in place because it only
supported conversions from 32 bpp. The patch adds colour conversion
code that support conversions from any resolution to any resolution.

A last note: to get most out of this patch it is best to set Windows
to 16 bit colour depth, because the 24 bit mode is 24 bit depth and 24
bpp, meaning no alpha channel. The vnc protocol doesn't support 24
bpp, only 32 bpp, so this conversion is unavoidable.

From: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
18 years agoxen-api: Fix some errors in Xen-API's PBD class.
Keir Fraser [Mon, 11 Feb 2008 14:51:22 +0000 (14:51 +0000)]
xen-api: Fix some errors in Xen-API's PBD class.
Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
18 years agoxen-api: Add TOC and hyperlink cross reference to xen-api document
Keir Fraser [Mon, 11 Feb 2008 14:50:50 +0000 (14:50 +0000)]
xen-api: Add TOC and hyperlink cross reference to xen-api document
Signed-off-by: Stefan Berger <stefanb@us.ibm.com>
18 years agoioemu: save 3MB of ioport tables (on 64bit machines)
Keir Fraser [Mon, 11 Feb 2008 14:47:19 +0000 (14:47 +0000)]
ioemu: save 3MB of ioport tables (on 64bit machines)
by keeping then initialized to NULL and check for it in the handlers.

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
18 years agoioemu: cope with partial reads/writes when using the read()/write()
Keir Fraser [Mon, 11 Feb 2008 14:47:06 +0000 (14:47 +0000)]
ioemu: cope with partial reads/writes when using the read()/write()
syscall interfaces.
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
18 years agox86 hvm: Allow HPET to be configured as a per-domain config option.
Keir Fraser [Mon, 11 Feb 2008 14:45:29 +0000 (14:45 +0000)]
x86 hvm: Allow HPET to be configured as a per-domain config option.

A new platform variable 'hpet' is added, which defaults to 0 for new
guests (that is, hpet disabled). Default is off (no hpet) because
hpet is currently less accurate in keeping time than PIT (because no
timer_mode adjustments).

Signed-off-by: Dan Magenheimer <dan.magenheimer@oracle.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
18 years agoxend: Better support for legacy HVM config with hvmloader configured
Keir Fraser [Mon, 11 Feb 2008 14:42:52 +0000 (14:42 +0000)]
xend: Better support for legacy HVM config with hvmloader configured
via the 'kernel' config option:
 1. Look for any string containing 'hvmloader'.
 2. The 'kernel' option must be scrubbed to avoid taking
 PV-kernel-loading paths during later guest setup.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
18 years agox86: Compile fix for p2m audit code.
Keir Fraser [Mon, 11 Feb 2008 10:57:17 +0000 (10:57 +0000)]
x86: Compile fix for p2m audit code.

From Tom Woller.
Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
18 years agovt-d: Remap interrupt for passthru device if such HW is detected on VT-d platforms.
Keir Fraser [Mon, 11 Feb 2008 10:51:41 +0000 (10:51 +0000)]
vt-d: Remap interrupt for passthru device if such HW is detected on VT-d platforms.
Signed-off-by: Allen Kay <allen.m.kay@intel.com>
18 years agox86: Fix build after xentrace changes.
Keir Fraser [Mon, 11 Feb 2008 10:50:57 +0000 (10:50 +0000)]
x86: Fix build after xentrace changes.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
18 years agoDocument XenStore's new SET_TARGET message
Keir Fraser [Mon, 11 Feb 2008 10:20:31 +0000 (10:20 +0000)]
Document XenStore's new SET_TARGET message
Signed-off-by: Ryan O'Connor <colossus@interchange.ubc.ca>
18 years agox86 shadow: Move the shadow linear mapping for n-on-3-on-4 shadows so
Keir Fraser [Mon, 11 Feb 2008 10:16:53 +0000 (10:16 +0000)]
x86 shadow: Move the shadow linear mapping for n-on-3-on-4 shadows so
that guest mappings of the bottom 4GB are not reflected in the monitor
pagetable. This ensures in particular that page 0 is not mapped,
allowing us to catch NULL dereferences in the hypervisor.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
18 years agoxend: Remove redundant xc.domain_setcpuweight() all the way down to libxenctrl.
Keir Fraser [Mon, 11 Feb 2008 10:15:07 +0000 (10:15 +0000)]
xend: Remove redundant xc.domain_setcpuweight() all the way down to libxenctrl.
Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
18 years agodomain builder: make vfb = [ 'type=sdl' ] work
Keir Fraser [Mon, 11 Feb 2008 10:06:51 +0000 (10:06 +0000)]
domain builder: make vfb = [ 'type=sdl' ] work

When setting

vfb = [ 'type=sdl' ]

in a domain config file, qemu seems to be still using vnc. Make it use
sdl as expected.

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
18 years agoioemu stubdom: make daemonize optional
Keir Fraser [Mon, 11 Feb 2008 10:03:48 +0000 (10:03 +0000)]
ioemu stubdom: make daemonize optional
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
18 years agoioemu: some ifndef NO_UNIX_SOCKETS were missing
Keir Fraser [Mon, 11 Feb 2008 10:03:19 +0000 (10:03 +0000)]
ioemu: some ifndef NO_UNIX_SOCKETS were missing
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
18 years agoioemu: make AIO optional (already done upstream)
Keir Fraser [Mon, 11 Feb 2008 10:03:05 +0000 (10:03 +0000)]
ioemu: make AIO optional (already done upstream)
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
18 years agoioemu: fix compilation without softfloat
Keir Fraser [Mon, 11 Feb 2008 10:02:39 +0000 (10:02 +0000)]
ioemu: fix compilation without softfloat
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
18 years agoioemu stubdom: make TPM optional
Keir Fraser [Mon, 11 Feb 2008 10:01:42 +0000 (10:01 +0000)]
ioemu stubdom: make TPM optional
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
18 years agoqemu: Queue mouse clicks.
Keir Fraser [Mon, 11 Feb 2008 09:57:38 +0000 (09:57 +0000)]
qemu: Queue mouse clicks.

qemu doesn't enqueue mouse events, just records the latest mouse
state. This can cause some lost mouse double clicks if the events are
not processed fast enought. This patch implements a simple queue for
left mouse click events.

Signed-off-by: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
18 years agoxentrace: Remove redundant tb_done_init checks, and add missing ones.
Keir Fraser [Mon, 11 Feb 2008 09:47:19 +0000 (09:47 +0000)]
xentrace: Remove redundant tb_done_init checks, and add missing ones.
Hand inspection of gcc -02 output confirms significantly shorter
codepaths for inactive (i.e. normal case) tracing.

Signed-off-by: Michael A Fetterman <Michael.Fetterman@cl.cam.ac.uk>
18 years agoxentrace: Improve xentrace to use VIRQ_TBUF interrupts as well as a
Keir Fraser [Mon, 11 Feb 2008 09:46:53 +0000 (09:46 +0000)]
xentrace: Improve xentrace to use VIRQ_TBUF interrupts as well as a
user-specified polling interval in order to determine when to empty
the trace buffers. Removed the old and unused/unimplemented
new_data_threshold logic.

Signed-off-by: Michael A Fetterman <Michael.Fetterman@cl.cam.ac.uk>
18 years agoxentrace: Allow xentrace to handle >4G of trace data.
Keir Fraser [Mon, 11 Feb 2008 09:46:21 +0000 (09:46 +0000)]
xentrace: Allow xentrace to handle >4G of trace data.
It was previously assert'ing when it hit 4G.

Also, because the trace buffer is not a power of 2 in size,
using modulo arithmetic to address the buffer does not work
when the index wraps around 2^32.

This patch fixes both issues, and as a side effect, removes all
integer division from the hypervisor side of the trace mechanism.

Signed-off-by: Michael A Fetterman <Michael.Fetterman@cl.cam.ac.uk>
18 years agoxentrace: Fix bug in logic for bytes_to_wrap in trace buffer.
Keir Fraser [Mon, 11 Feb 2008 09:45:36 +0000 (09:45 +0000)]
xentrace: Fix bug in logic for bytes_to_wrap in trace buffer.
Admittedly, the bug could only be manifest with much larger trace
records than are currently allowed (or equivalently, much smaller
trace buffers), but the old code was harder to read, and thus hid the
logic bug well, too.

Signed-off-by: Michael A Fetterman <Michael.Fetterman@cl.cam.ac.uk>
18 years agox86_emulate: Fix IMUL r/m8 emulation.
Keir Fraser [Thu, 7 Feb 2008 19:30:36 +0000 (19:30 +0000)]
x86_emulate: Fix IMUL r/m8 emulation.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
18 years agovmx realmode: Add REP MOVS handler.
Keir Fraser [Thu, 7 Feb 2008 18:57:12 +0000 (18:57 +0000)]
vmx realmode: Add REP MOVS handler.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
18 years agox86_emulate: Handle rep_ins, rep_outs, rep_movs hook failure and fall
Keir Fraser [Thu, 7 Feb 2008 18:56:47 +0000 (18:56 +0000)]
x86_emulate: Handle rep_ins, rep_outs, rep_movs hook failure and fall
back to slow path.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
18 years agox86_emulate: Fix MUL emulation.
Keir Fraser [Thu, 7 Feb 2008 18:00:44 +0000 (18:00 +0000)]
x86_emulate: Fix MUL emulation.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
18 years agoioemu: use POSIX int type.
Keir Fraser [Thu, 7 Feb 2008 13:21:38 +0000 (13:21 +0000)]
ioemu: use POSIX int type.
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
18 years agox86: physaddr_bitsize must always be initialised for 32-on-64 dom0.
Keir Fraser [Thu, 7 Feb 2008 13:20:15 +0000 (13:20 +0000)]
x86: physaddr_bitsize must always be initialised for 32-on-64 dom0.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
18 years agoioemu: Fix build after LIST->QEMU_LIST changes.
Keir Fraser [Thu, 7 Feb 2008 13:19:19 +0000 (13:19 +0000)]
ioemu: Fix build after LIST->QEMU_LIST changes.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
18 years agovmx: Clean up VPMU code a little and remove noisy printk.
Keir Fraser [Thu, 7 Feb 2008 10:47:20 +0000 (10:47 +0000)]
vmx: Clean up VPMU code a little and remove noisy printk.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
18 years agohvm: Clean up CPUID_0000_0001 return values.
Keir Fraser [Thu, 7 Feb 2008 10:31:48 +0000 (10:31 +0000)]
hvm: Clean up CPUID_0000_0001 return values.
The fix to EBX.ApicID was pointed out by Andre Przywara
<andre.przywara@amd.com>.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
18 years agoAdd 'coredump-destroy' and 'coredump-restart' actions for crashed domains.
Keir Fraser [Thu, 7 Feb 2008 09:28:55 +0000 (09:28 +0000)]
Add 'coredump-destroy' and 'coredump-restart' actions for crashed domains.

Xen-API already specifies these actions for the 'on_crash' domain exit
event. This patch makes them available for use in traditional domU
config files and through the xm tool as well.

Signed-off-by: Jim Fehlig <jfehlig@novell.com>
18 years agoxm reboot: Fix wait option of xm reboot command
Keir Fraser [Thu, 7 Feb 2008 09:27:46 +0000 (09:27 +0000)]
xm reboot: Fix wait option of xm reboot command

When I rebooted a domain by xm reboot command with wait option,
I saw the following message.  But, rebooting the domain succeeded.
 Domain vm1 destroyed for failed in rebooting

The cause why the message was shown is the domain is destroyed
temporarily by processing of xm reboot command.  The domain
information is not gotten from Xend by server.xend.domains()
function till recreating the domain is completed.
This patch fixes processing of xm reboot command in Xm side.
It waits just a bit till recreating the domain is completed,
then it measures the success or failure of the reboot of the
domain.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
18 years agoioemu: avoid name clashes due to LIST_* macros
Keir Fraser [Thu, 7 Feb 2008 09:21:19 +0000 (09:21 +0000)]
ioemu: avoid name clashes due to LIST_* macros

Here is what I wrote in my submission to qemu upstream:

 qemu's audio subdirectory contains a copy of BSD's sys-queue.h, which
 defines a bunch of LIST_ macros.  This makes it difficult to build a
 program made partly out of qemu and partly out of the Linux
 kernel[1], since Linux has a different set of LIST_ macros.  It might
 also cause trouble when mixing with BSD-derived code.

 Under the circumstances it's probably best to rename the versions in
 qemu.  The attached patch does this.

 [1] You might well ask why anyone would want to do this.  In Xen we
 are moving our emulation of IO devices from processes which run on
 the host into a dedicated VM (one per actual VM) which we call a
 `stub domain'.  This dedicated VM runs a very cut-down `operating
 system' which uses some code from Linux.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
18 years agoioemu: config cleanup re AF_UNIX sockets on non-Windows
Keir Fraser [Thu, 7 Feb 2008 09:19:12 +0000 (09:19 +0000)]
ioemu: config cleanup re AF_UNIX sockets on non-Windows

Here is what I wrote in my submission to qemu upstream:

 The patch below makes it possible to disable AF_UNIX (unix-domain)
 sockets in host environments which do not define _WIN32, by adding
 -DNO_UNIX_SOCKETS to the compiler flags.  This is useful in the
 effectively-embedded qemu host which are going to be using for device
 emulation in Xen.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
18 years agominios: Fix blkfront grant map leak
Keir Fraser [Thu, 7 Feb 2008 09:16:20 +0000 (09:16 +0000)]
minios: Fix blkfront grant map leak

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
18 years agominios: Support net/block backend in domU
Keir Fraser [Thu, 7 Feb 2008 09:15:59 +0000 (09:15 +0000)]
minios: Support net/block backend in domU

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
18 years agohvmloader: Remove dead function check_amd().
Keir Fraser [Wed, 6 Feb 2008 18:31:02 +0000 (18:31 +0000)]
hvmloader: Remove dead function check_amd().
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
18 years agox86 vmx: Remove vmxassist.
Keir Fraser [Wed, 6 Feb 2008 12:07:55 +0000 (12:07 +0000)]
x86 vmx: Remove vmxassist.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
18 years agoRevert 16973:b5427f2d83c3, which breaks automated testing (HVM qemu-dm
Keir Fraser [Tue, 5 Feb 2008 23:27:12 +0000 (23:27 +0000)]
Revert 16973:b5427f2d83c3, which breaks automated testing (HVM qemu-dm
will not die when it is told to).
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
18 years agox86_emulate: fix side-effect macro call.
Keir Fraser [Tue, 5 Feb 2008 15:50:59 +0000 (15:50 +0000)]
x86_emulate: fix side-effect macro call.
Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
18 years agovmx realmode: Emulate protected-mode transition while CS and SS have
Keir Fraser [Tue, 5 Feb 2008 15:45:10 +0000 (15:45 +0000)]
vmx realmode: Emulate protected-mode transition while CS and SS have
bad selector values (bottom two bits non-zero).

Allows opensuse 10.3 install CD to boot. Unfortunately SUSE Linux 10.1
install CD still fails to work...

Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
18 years agoxend: Scrub vnc password for vfb from xend.log.
Keir Fraser [Tue, 5 Feb 2008 10:40:10 +0000 (10:40 +0000)]
xend: Scrub vnc password for vfb from xend.log.
Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
18 years agoxend: Restore values of /vm/uuid/xend/* to recreated domains.
Keir Fraser [Tue, 5 Feb 2008 10:39:35 +0000 (10:39 +0000)]
xend: Restore values of /vm/uuid/xend/* to recreated domains.

When guest domains are restarted, previous values of /vm/uuid/xend/*
in xenstore are lost.  (e.g. previous_restart_time,
last_shutdown_reason). This patch restores them to restarting domains.
And we should update /vm/uuid/xend/restart_count of restarting
domains, not previous domains.

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
18 years agox86_emulate: Fix SAHF emulation.
Keir Fraser [Tue, 5 Feb 2008 10:29:19 +0000 (10:29 +0000)]
x86_emulate: Fix SAHF emulation.
Signed-off-by: Xiaohui Xin <xiaohui.xin@intel.com>
Signed-off-by: Kevin Tian <kevin.tian@intel.com>
18 years agox86: adjust reserved bit page fault handling
Keir Fraser [Mon, 4 Feb 2008 13:57:01 +0000 (13:57 +0000)]
x86: adjust reserved bit page fault handling
Signed-off-by: Jan Beulich <jbeulich@novell.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
18 years agox86 shadow: Cleanup for early-unshadow code.
Keir Fraser [Mon, 4 Feb 2008 13:51:17 +0000 (13:51 +0000)]
x86 shadow: Cleanup for early-unshadow code.

The unhooking of toplevel shadow entries has been removed; the rest of
the early-unshadow code needs to reflect that.

Signed-off-by: Tim Deegan <Tim.Deegan@citrix.com>
18 years agoioemu: use SIGHUP instead of SIGKILL
Keir Fraser [Mon, 4 Feb 2008 13:44:29 +0000 (13:44 +0000)]
ioemu: use SIGHUP instead of SIGKILL

The stub domain device model needs to trap the termination signal so
as to actually destroy the stub domain.  SIGKILL can't be trapped,
SIGTERM is caught by SDL and so may be unnoticed.  SIGHUP can be
trapped and is not caught by SDL (and by default causes a process
termination without core).

Signed-off-by: Samuel Thibault <samuel.thibault@eu.citrix.com>
18 years agoRevert 16947:32b898768217027. Breaks HVM qcow-backed discs.
Keir Fraser [Mon, 4 Feb 2008 13:42:53 +0000 (13:42 +0000)]
Revert 16947:32b898768217027. Breaks HVM qcow-backed discs.
Sigend-off-by: Keir Fraser <keir.fraser@citrix.com>
18 years agohvm: FPU management cleanups.
Keir Fraser [Sun, 3 Feb 2008 10:22:08 +0000 (10:22 +0000)]
hvm: FPU management cleanups.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
18 years agovmx realmode: HOST_CR0.TS must be cleared when restoring guest FPU
Keir Fraser [Sun, 3 Feb 2008 09:30:59 +0000 (09:30 +0000)]
vmx realmode: HOST_CR0.TS must be cleared when restoring guest FPU
state, otherwise in-Xen CR0.TS value becomes set again on next
vmexit. Then we crash the next time we try to emulate an FPU
instruction.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
18 years agoRevert 16963:d29d74d4eeac and 16750:2ac0fd9fd4b4.
Keir Fraser [Sun, 3 Feb 2008 09:09:21 +0000 (09:09 +0000)]
Revert 16963:d29d74d4eeac and 16750:2ac0fd9fd4b4.
Continue to SIGKILL qemu-dm so that 'xm destroy' should always work
rather than hang if qemu-dm is in a bad state.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
18 years agoFix hvmloader makefile dependencies, and do not recurse into
Keir Fraser [Sat, 2 Feb 2008 13:40:43 +0000 (13:40 +0000)]
Fix hvmloader makefile dependencies, and do not recurse into
tools/firmware/etherboot by default (the dependency of eb_roms.h on
Config does not seem to always prevent the build from going ahead, for
some reason).
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
18 years agoetherboot: Supply pre-built option ROMs to avoid needing to build
Keir Fraser [Sat, 2 Feb 2008 11:24:20 +0000 (11:24 +0000)]
etherboot: Supply pre-built option ROMs to avoid needing to build
Etherboot from scratch in most situations.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
18 years agoFix to Xen NAT network scripts for Debian.
Keir Fraser [Sat, 2 Feb 2008 10:55:25 +0000 (10:55 +0000)]
Fix to Xen NAT network scripts for Debian.
Xen recently (changeset 16873:86c32269ba60) started looking for a
DHCP defaults file in /etc/sysconfig/dhcpd or /etc/defaults/dhcp.
Debian (lenny) puts this file in a different place though:
/etc/default/dhcp3-server.  I added this location to Xen's search
path.

From: Michael Abd-El-Malek <mabdelmalek@cmu.edu>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
18 years agoxend: Fix grow of the LEGACY_UNSUPPORTED_BY_XENAPI_CFG list each time
Keir Fraser [Sat, 2 Feb 2008 10:53:24 +0000 (10:53 +0000)]
xend: Fix grow of the LEGACY_UNSUPPORTED_BY_XENAPI_CFG list each time
we instantiate a new XendConfig.
Signed-off-by: Pascal Bouchareine <pascal@gandi.net>
18 years agoFix save/restore failure cleanup
Keir Fraser [Sat, 2 Feb 2008 10:51:54 +0000 (10:51 +0000)]
Fix save/restore failure cleanup

The save failure cleanup introduced in 13543:207523704fb1 is
incorrect: if we didn't get as far as actually suspending the domain,
then the guest domain will not be expecting the devices to be removed
(seen on both Linux and Solaris, which don't expect a 'Closing' state
when they hold the device open). Only re-jig devices if we definitely
shut the domain down.

Signed-off-by: John Levon <john.levon@sun.com>
18 years agohvm: Fix 'xm save' bug in qhich qemu-dm ignores SIGTERM.
Keir Fraser [Fri, 1 Feb 2008 12:01:34 +0000 (12:01 +0000)]
hvm: Fix 'xm save' bug in qhich qemu-dm ignores SIGTERM.

When saving a guest in early ChangeSet (Before 16750), Xend will
send "SIGKILL" signal to kill qemu process. But in ChangeSet 16750,
the signal is modified to "SIGTERM". However, "SIGTERM" handler has
been registered by SDL in qemu. So when qemu process receives a
"SIGTERM", SDL will catch it and it will push out a "SDL_QUIT" even to
qemu. If qemu can receive that event, it will be successfully
terminated. While we do "xm save", qemu can't go out from the dead
loop "while (suspend_requested) {...}" in main_loop() to handle the
SQL_QUIT event. So it is unable to poll that "SDL_QUIT" event. This
makes xm save command hang. This fix enables qemu to poll the
"SDL_QUIT" event while doing save.

Signed-off-by: Xu Dongxiao <dongxiao.xu@intel.com>
18 years agox86 shadow: Fix cross-page write emulation failure.
Keir Fraser [Fri, 1 Feb 2008 11:21:27 +0000 (11:21 +0000)]
x86 shadow: Fix cross-page write emulation failure.
Signed-off-by: Disheng Su <disheng.su@intel.com>
18 years agoDirect Linux boot: XenD changes for HVM direct Linux boot.
Keir Fraser [Fri, 1 Feb 2008 11:18:15 +0000 (11:18 +0000)]
Direct Linux boot: XenD changes for HVM direct Linux boot.

This patch provides the tools support for direct kernel boot of
HVM guests. Currently the config files in /etc/xen support the
args  'kernel', 'ramdisk' and 'extra'. For PV guests these have
the obvious meaning.

Unfortunately HVM guest configs hijacked the 'kernel' parameter
and use it to refer to the path of the HVM firmware. So, this
patch adds a new config file parameter called 'loader' which is
used to refer to the HVM firmware instead.

The conventions for loading the initrd image say that it should
live at the end of memory. This requires QEMU to know the size
of the guest's initial RAM allocation, so image.py is changed
to pass the '-m' flag to QEMU.

The HVMImageHandler class in image.py is changed so that if the
'kernel', 'ramdisk' or 'extra' params were given in the config
these are passed to QEMU with the '-kernel', '-initrd' and
'-append' flags respectively.

Finally, the 'loader' param is used as the arg to 'xc_hvm_build'
instead of the old 'kernel' param.

For the sake of compatability with old HVM guest config files,
if the config file has a 'kernel' param whose path matches that
of the HVM firmware, then we automatically convert this 'kernel'
param into the 'loader' param. This ensures existing HVM guests
work without changes required.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
18 years agoDirect Linux boot: Support booting non-relocatable Linux kernels.
Keir Fraser [Fri, 1 Feb 2008 11:16:37 +0000 (11:16 +0000)]
Direct Linux boot: Support booting non-relocatable Linux kernels.

This patch introduces a hack to make non-relocatable kernels
bootable too. Non-relocatable kernels absolutely want to run
at 0x100000 and are not at all happy about being at 0x200000.
Fortunately, thanks to crazy programs like LOADLIN, Linux has
a couple of hooks in its boot process which can be used to
play games. The 'code32_switch' hook is executed immediately
following the switch to protected mode.

So, this patch installs a hook at 0x200000+kernel_size. The hook
is hand crafted assembly which sets up all the segments as needed,
then essentially does memmove(0x100000,0x200000,kernel_size) and
finally does an unconditional jmp to 0x100000.

Amazingly this actually really does work. It has been successfully
tested with RHEL-2.1 and Fedora Core 6 install kernels on i386, and
Fedora Core 6 and 7 kernels on x86_64.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
18 years agoDirect Linux boot: Support booting relocatable Linux kernels.
Keir Fraser [Fri, 1 Feb 2008 11:14:53 +0000 (11:14 +0000)]
Direct Linux boot: Support booting relocatable Linux kernels.

This patch introduces the basic infrastructure for direct kernel
boot in the ioemu copy of QEMU. The current #ifdef disabled
code is actually obsolete wrt to upstream QEMU code. So this
is removed entirely. In its place I have imported the latest
upstream QEMU code. The QEMU code assumes that the guest RAM
is directly mapped into the QEMU process, so there were some
changes neccessary. Instead of strcpy/memcpy'ing the args
and kernel header into guest RAM, cpu_physical_memory_rw is
used. Intead of fread() the initrd and kernel into guest RAM
a helper function is used fread2guest which reads into a small
buffer and then uses cpu_physical_memory_rw.

NB in reading the following, Documentation/i386/boot.txt is
a useful reference for what's going on.

Next, instead of loading the kernel at 0x100000, this code
loads it at 0x200000. This is far enough away that there's
no risk of it overlapping with the HVM firmware image. If the
Linux kernel boot protocol is 0x205 or later, and the flag
at offset 0x234 in the kernel header is 1, then the guest
kernel was built with CONFIG_RELOCATABLE=y.

In this scenario we merely need to tell the kernel what address
it has been relocated to by writing 0x200000 into the kernel
header at offset 0x214. When switching from real mode into
protected mode the kernel will immediately start executing at
0x200000 and be happy with life. This should work for 2.6.20 or
later on i386, and 2.6.22 or later on x86_64.

This has been verified with Fedora 7 and Fedora 8 bare metal kernels
on i386 and x86_64 from the $TREE/images/pxeboot of the install trees.

Signed-off-by: Daniel P. Berrange <berrange@redhat.com>
18 years agohvm: Etherboot for E100 NIC
Keir Fraser [Thu, 31 Jan 2008 16:23:35 +0000 (16:23 +0000)]
hvm: Etherboot for E100 NIC
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
Signed-off-by: Yosuke Iwamatsu <y-iwamatsu@ab.jp.nec.com>
18 years agoRemove unused find-gcc-3 script.
Keir Fraser [Thu, 31 Jan 2008 14:14:23 +0000 (14:14 +0000)]
Remove unused find-gcc-3 script.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
18 years agoetherboot: Fix the build.
Keir Fraser [Thu, 31 Jan 2008 14:01:59 +0000 (14:01 +0000)]
etherboot: Fix the build.
Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
18 years agovmx realmode: Exception delivery clears interrupt shadow.
Keir Fraser [Thu, 31 Jan 2008 13:01:08 +0000 (13:01 +0000)]
vmx realmode: Exception delivery clears interrupt shadow.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
18 years agoFix x86/64 Xen build.
Keir Fraser [Thu, 31 Jan 2008 11:05:14 +0000 (11:05 +0000)]
Fix x86/64 Xen build.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
18 years agoFix xm shutdown/reboot for HVM domain of IA64
Keir Fraser [Thu, 31 Jan 2008 09:43:05 +0000 (09:43 +0000)]
Fix xm shutdown/reboot for HVM domain of IA64

xc.domain_destroy_hook() is called twice when we execute
xm shutdown/reboot command to an HVM domain without PV drivers.
The first calling is from shutdown() in XendDomainInfo.py.
The second calling is from destroyDomain() in XendDomainInfo.py.
The first calling is not necessary, so this patch removes it.

A discussion about this patch is as follows.
 http://lists.xensource.com/archives/html/xen-ia64-devel/2008-01/msg00232.html

Signed-off-by: Masaki Kanno <kanno.masaki@jp.fujitsu.com>
18 years agoSmall fix for VMX Core2 perfctr access.
Keir Fraser [Thu, 31 Jan 2008 09:41:32 +0000 (09:41 +0000)]
Small fix for VMX Core2 perfctr access.
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
18 years agolibxc: Fix the third argument of bitmap_64_to_byte in xc_tbuf_set_cpu_mask
Keir Fraser [Thu, 31 Jan 2008 09:39:44 +0000 (09:39 +0000)]
libxc: Fix the third argument of bitmap_64_to_byte in xc_tbuf_set_cpu_mask
Signed-off-by: Eric Liu <eric.e.liu@intel.com>
18 years agobuild: Make PREFIX work by fixing LIBDIR
Keir Fraser [Thu, 31 Jan 2008 09:38:34 +0000 (09:38 +0000)]
build: Make PREFIX work by fixing LIBDIR

In the current tree, setting PREFIX does not work very well.  This is
because of confusion about the meaning of LIBDIR.  In some places it
is the pathname tail of directories containing libraries (lib, lib64
or lib/amd64).  But in other places it is a destination pathname
(implicitly, including any PREFIX).  This can result in PREFIX or /usr
being added the wrong number of times.

This patch splits LIBDIR into two variables, LIBLEAFDIR and
LIBDIR.  LIBDIR is the directory into which Xen libraries and other
similar code is to be placed, and includes any PREFIX.  LIBLEAFDIR is
just the library tail and can be appended to various different
prefixes; for example, to construct the X11 library directory for -L.

Neither variable contains the value of DESTDIR, which is of course
used only to redirect the results of `make install' when desired.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>
18 years agovmx realmode: Emulate MSR accesses.
Keir Fraser [Thu, 31 Jan 2008 09:33:26 +0000 (09:33 +0000)]
vmx realmode: Emulate MSR accesses.
Signed-off-by: Nitin A Kamble <nitin.a.kamble@intel.com>
Signed-off-by: Keir Fraser <keir.fraser@citrix.com>
18 years agoAdd DTrace support to xenstored
Keir Fraser [Thu, 31 Jan 2008 09:13:27 +0000 (09:13 +0000)]
Add DTrace support to xenstored

Add USDT probes for significant xenstore operations to allow dynamic
tracing.

Signed-off-by: John Levon <john.levon@sun.com>
18 years agoioemu: Stop PV guest from parsing xenstore and opening block devices.
Keir Fraser [Thu, 31 Jan 2008 09:11:21 +0000 (09:11 +0000)]
ioemu: Stop PV guest from parsing xenstore and opening block devices.

PV guests are now using QEMU for a vncserver.  During initialization
of QEMU xenstore_parse_config() is being called causing PV guests to
open block devices.  This patch makes a new function,
xenstore_daemon_open(), so that the vnc password functions have an
open xenstore handle and moves xenstore_parse_config() into the FV
machine specific init function.

Signed-off-by: Pat Campbell <plc@novell.com>
18 years agoBuild etherboot ROM from source.
Ian Jackson [Wed, 30 Jan 2008 18:39:04 +0000 (18:39 +0000)]
Build etherboot ROM from source.

We now include the source for Etherboot (5.4.2, obtained from git)
rather than a pre-built ROM.  This gives better traceability and GPL
licence compliance.  See tools/firmware/etherboot/README for details.

Signed-off-by: Ian Jackson <ian.jackson@eu.citrix.com>